<template>
    <div class="app-container">
        <el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="100px">
            <el-form-item label="订单编号" prop="orderCode">
                <el-input v-model="queryParams.orderCode" placeholder="请输入订单编号" clearable @keyup.enter.native="handleQuery" />
            </el-form-item>
            <!-- <el-form-item label="支付金额" prop="payMoney">
                <el-input v-model="queryParams.payMoney" placeholder="请输入支付金额-分" clearable @keyup.enter.native="handleQuery" />
            </el-form-item> -->
            <el-form-item label="本人姓名" prop="peopleName">
                <el-input v-model="queryParams.peopleName" placeholder="请输入本人姓名" clearable @keyup.enter.native="handleQuery" />
            </el-form-item>
            <el-form-item label="手机号码" prop="phone">
                <el-input v-model="queryParams.phone" placeholder="请输入手机号码" clearable @keyup.enter.native="handleQuery" />
            </el-form-item>
            <el-form-item>
                <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
                <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
            </el-form-item>
        </el-form>

        <el-row :gutter="10" class="mb8">
            <!-- <el-col :span="1.5">
                <el-button type="primary" plain icon="el-icon-plus" size="mini" @click="handleAdd" v-hasPermi="['system:order:add']">新增</el-button>
            </el-col>
            <el-col :span="1.5">
                <el-button type="success" plain icon="el-icon-edit" size="mini" :disabled="single" @click="handleUpdate"
                    v-hasPermi="['system:order:edit']">修改</el-button>
            </el-col>
            <el-col :span="1.5">
                <el-button type="danger" plain icon="el-icon-delete" size="mini" :disabled="multiple" @click="handleDelete"
                    v-hasPermi="['system:order:remove']">删除</el-button>
            </el-col> -->
            <el-col :span="1.5">
                <el-button type="warning" plain icon="el-icon-download" size="mini" @click="handleExport"
                    v-hasPermi="['system:order:export']">导出</el-button>
            </el-col>
            <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
        </el-row>

        <el-table v-loading="loading" :data="orderList">
            <!-- <el-table-column type="selection" width="55" align="center" /> -->
            <!-- <el-table-column label="ID" align="center" prop="id" /> -->
            <!-- <el-table-column label="订单编号" align="center" prop="orderCode" /> -->
            <!-- <el-table-column label="签证基础表ID" align="center" prop="baseId" /> -->
            <!-- <el-table-column label="用户ID" align="center" prop="userId" /> -->
            <!-- <el-table-column label="微信用户唯一标识" align="center" prop="openId" /> -->

            <el-table-column label="本人姓名" align="center" prop="peopleName" />
            <el-table-column label="手机号码" align="center" prop="phone" />
            <el-table-column label="订单类型" align="center" prop="orderType">
                <template slot-scope="scope">
                    <div v-if="scope.row.orderType==0">普通</div>
                    <div v-if="scope.row.orderType==1">快速</div>
                    <div v-if="scope.row.orderType==2">团购</div>
                </template>
            </el-table-column>
            <el-table-column label="订单状态" align="center" prop="orderStatus">
                <template slot-scope="scope">
                    <div v-if="scope.row.orderStatus==0">待支付</div>
                    <div v-if="scope.row.orderStatus==1">已支付</div>
                    <div v-if="scope.row.orderStatus==2">已退款</div>
                    <div v-if="scope.row.orderStatus==3">已取消</div>
                </template>
            </el-table-column>
            <!-- <el-table-column label="支付时间" align="center" prop="payTime" width="180">
                <template slot-scope="scope">
                    <span>{{ parseTime(scope.row.payTime, "{y}-{m}-{d}") }}</span>
                </template>
            </el-table-column>
            <el-table-column label="退款时间" align="center" prop="refundTime" width="180">
                <template slot-scope="scope">
                    <span>{{ parseTime(scope.row.refundTime, "{y}-{m}-{d}") }}</span>
                </template>
            </el-table-column> -->
            <el-table-column label="审核状态" align="center" prop="reviewStatus">
                <template slot-scope="scope">
                    <div v-if="scope.row.reviewStatus==0">未通过</div>
                    <div v-if="scope.row.reviewStatus==1">已通过</div>
                    <div v-if="scope.row.reviewStatus==null">申请中</div>
                </template>
            </el-table-column>
            <!-- <el-table-column label="审核意见 " align="center" prop="reviewRemark" /> -->
            <!-- <el-table-column label="支付渠道  WX   ALI" align="center" prop="payChannel" /> -->
            <el-table-column label="支付金额" align="center" prop="payMoney" />
            <!-- <el-table-column label="支付回调通知 0-未通知 1-已通知" align="center" prop="payCallbackFlag" /> -->
            <!-- <el-table-column label="支付回调请求内容" align="center" prop="payCallbackRespone" /> -->
            <!-- <el-table-column label="交易流水号" align="center" prop="transCode" /> -->
            <!-- <el-table-column label="pdf文件路径   order_status=1 review_status=1时有" align="center" prop="visaPdf" /> -->
            <!-- <el-table-column label="文件上传时间  order_status=1 review_status=1时有" align="center" prop="pdfCreateTile" width="180">
                <template slot-scope="scope">
                    <span>{{ parseTime(scope.row.pdfCreateTile, "{y}-{m}-{d}") }}</span>
                </template>
            </el-table-column> -->
            <!-- <el-table-column label="本人家庭地址" align="center" prop="address" />
            <el-table-column label="紧急联系人姓名" align="center" prop="contactsName" />
            <el-table-column label="紧急联系人手机号" align="center" prop="contactsPhone" />
            <el-table-column label="婚姻状况 0-未婚 1-已婚 2-离婚 3-其他" align="center" prop="maritalStatus" />
            <el-table-column label="工作状况  0-自由职业 1-农牧民 2-学生 3-个体户 4-普通职员 5-企业高管/老板 6-专业技术员 7-公务员/事业单位人员  8-退休人员 9-其他" align="center"
                prop="workStatus" />
            <el-table-column label="护照照片img" align="center" prop="passportImg" />
            <el-table-column label="备注" align="center" prop="remark" /> -->
            
            <el-table-column label="创建时间 " align="center" prop="createTime" width="155"/>
            <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
                <template slot-scope="scope">

                    <el-button size="mini" type="text" icon="el-icon-document" @click="handleDetail(scope.row)">详情</el-button>
                    <el-button v-if="scope.row.reviewStatus==2&&scope.row.orderStatus==1" size="mini" type="text" icon="el-icon-check"
                        @click="handlePreApproval(scope.row,'1')">审核通过</el-button>
                    <el-button v-if="scope.row.reviewStatus==2&&scope.row.orderStatus==1" size="mini" type="text" icon="el-icon-close"
                        @click="handlePreApproval(scope.row,'0')">审核拒绝</el-button>
                    <!-- <el-button size="mini" type="text" icon="el-icon-edit" @click="handleUpdate(scope.row)"
                        v-hasPermi="['system:order:edit']">修改</el-button>
                    <el-button size="mini" type="text" icon="el-icon-delete" @click="handleDelete(scope.row)"
                        v-hasPermi="['system:order:remove']">删除</el-button> -->
                </template>
            </el-table-column>
        </el-table>

        <pagination v-show="total > 0" :total="total" :page.sync="queryParams.pageNum" :limit.sync="queryParams.pageSize" @pagination="getList" />

        <!-- 添加或修改签证订单对话框 -->
        <el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
            <el-form ref="form" :model="form" :rules="rules" label-width="80px">
                <el-form-item label="订单编号" prop="orderCode">
                    <el-input v-model="form.orderCode" placeholder="请输入订单编号" />
                </el-form-item>
                <el-form-item label="签证基础表ID" prop="baseId">
                    <el-input v-model="form.baseId" placeholder="请输入签证基础表ID" />
                </el-form-item>
                <el-form-item label="用户ID" prop="userId">
                    <el-input v-model="form.userId" placeholder="请输入用户ID" />
                </el-form-item>
                <el-form-item label="微信用户唯一标识" prop="openId">
                    <el-input v-model="form.openId" placeholder="请输入微信用户唯一标识" />
                </el-form-item>
                <el-form-item label="支付时间  仅order_status=1 有值" prop="payTime">
                    <el-date-picker clearable v-model="form.payTime" type="date" value-format="yyyy-MM-dd" placeholder="请选择支付时间  仅order_status=1 有值">
                    </el-date-picker>
                </el-form-item>
                <el-form-item label="退款时间  仅order_status=2 有值" prop="refundTime">
                    <el-date-picker clearable v-model="form.refundTime" type="date" value-format="yyyy-MM-dd"
                        placeholder="请选择退款时间  仅order_status=2 有值">
                    </el-date-picker>
                </el-form-item>
                <el-form-item label="审核意见 " prop="reviewRemark">
                    <el-input v-model="form.reviewRemark" placeholder="请输入审核意见 " />
                </el-form-item>
                <el-form-item label="支付渠道  WX   ALI" prop="payChannel">
                    <el-input v-model="form.payChannel" placeholder="请输入支付渠道  WX   ALI" />
                </el-form-item>
                <el-form-item label="支付金额-分" prop="payMoney">
                    <el-input v-model="form.payMoney" placeholder="请输入支付金额-分" />
                </el-form-item>
                <el-form-item label="支付回调通知 0-未通知 1-已通知" prop="payCallbackFlag">
                    <el-input v-model="form.payCallbackFlag" placeholder="请输入支付回调通知 0-未通知 1-已通知" />
                </el-form-item>
                <el-form-item label="支付回调请求内容" prop="payCallbackRespone">
                    <el-input v-model="form.payCallbackRespone" type="textarea" placeholder="请输入内容" />
                </el-form-item>
                <el-form-item label="交易流水号" prop="transCode">
                    <el-input v-model="form.transCode" placeholder="请输入交易流水号" />
                </el-form-item>
                <el-form-item label="pdf文件路径   order_status=1 review_status=1时有" prop="visaPdf">
                    <el-input v-model="form.visaPdf" type="textarea" placeholder="请输入内容" />
                </el-form-item>
                <el-form-item label="文件上传时间  order_status=1 review_status=1时有" prop="pdfCreateTile">
                    <el-date-picker clearable v-model="form.pdfCreateTile" type="date" value-format="yyyy-MM-dd"
                        placeholder="请选择文件上传时间  order_status=1 review_status=1时有">
                    </el-date-picker>
                </el-form-item>
                <el-form-item label="本人姓名" prop="peopleName">
                    <el-input v-model="form.peopleName" placeholder="请输入本人姓名" />
                </el-form-item>
                <el-form-item label="手机号码" prop="phone">
                    <el-input v-model="form.phone" placeholder="请输入手机号码" />
                </el-form-item>
                <el-form-item label="本人家庭地址" prop="address">
                    <el-input v-model="form.address" placeholder="请输入本人家庭地址" />
                </el-form-item>
                <el-form-item label="紧急联系人姓名" prop="contactsName">
                    <el-input v-model="form.contactsName" placeholder="请输入紧急联系人姓名" />
                </el-form-item>
                <el-form-item label="紧急联系人手机号" prop="contactsPhone">
                    <el-input v-model="form.contactsPhone" placeholder="请输入紧急联系人手机号" />
                </el-form-item>
                <el-form-item label="护照照片img" prop="passportImg">
                    <el-input v-model="form.passportImg" placeholder="请输入护照照片img" />
                </el-form-item>
                <el-form-item label="删除标志" prop="delFlag">
                    <el-input v-model="form.delFlag" placeholder="请输入删除标志" />
                </el-form-item>
                <el-form-item label="备注" prop="remark">
                    <el-input v-model="form.remark" type="textarea" placeholder="请输入内容" />
                </el-form-item>
            </el-form>
            <div slot="footer" class="dialog-footer">
                <el-button type="primary" @click="submitForm">确 定</el-button>
                <el-button @click="cancel">取 消</el-button>
            </div>
        </el-dialog><!-- 订单详情 -->
        <el-dialog title="订单详情" class="fromDetail" :visible.sync="orderDetail" width="1200px" append-to-body>
            <el-form ref="form" :model="detailInfo" :rules="rules" label-width="150px">
                <div class="fromtitle">
                    <div>签证国家</div>
                </div>
                <el-row>
                    <el-col :span="12">
                        <el-form-item label="签证国家">
                            <div>{{detailInfo.base.countryChineseName}}</div>
                        </el-form-item>
                    </el-col>
                </el-row>
                <div class="fromtitle">
                    <div>基础信息</div>
                </div>
                <el-row>
                    <el-col :span="12">
                        <el-form-item label="本人姓名">
                            <div>{{detailInfo.order.peopleName}}</div>
                        </el-form-item>
                    </el-col>
                    <el-col :span="12">
                        <el-form-item label="手机号码">
                            <div>{{detailInfo.order.phone}}</div>
                        </el-form-item>
                    </el-col>
                    <el-col :span="12">
                        <el-form-item label="本人家庭地址">
                            <div>{{detailInfo.order.address}}</div>
                        </el-form-item>
                    </el-col>
                    <el-col :span="24">
                        <el-form-item label="一寸照" prop="headPhoto">
                            <el-image v-for="(item,index) in detailInfo.order.headPhoto?detailInfo.order.headPhoto.split(','):[]" :key="index"
                                style="width: 100px; height: 100px" :src="item"
                                :preview-src-list="detailInfo.order.headPhoto?detailInfo.order.headPhoto.split(','):[]">
                            </el-image>
                        </el-form-item>
                    </el-col>
                    <el-col :span="12">
                        <el-form-item label="紧急联系人电话号码1">
                            <div>{{detailInfo.order.contactsName}}</div>
                        </el-form-item>
                    </el-col>
                    <el-col :span="12">
                        <el-form-item label="紧急联系人电话号码2">
                            <div>{{detailInfo.order.contactsPhone}}</div>
                        </el-form-item>
                    </el-col>
                    <el-col :span="12">
                        <el-form-item label="婚姻状况" prop="maritalStatus">
                            <div v-if="detailInfo.order.maritalStatus==0">未婚</div>
                            <div v-if="detailInfo.order.maritalStatus==1">已婚</div>
                            <div v-if="detailInfo.order.maritalStatus==2">离婚</div>
                            <div v-if="detailInfo.order.maritalStatus==3">其他</div>
                        </el-form-item>
                    </el-col>
                    <el-col :span="12">
                        <el-form-item label="工作状况" prop="workStatus">
                            <div v-if="detailInfo.order.workStatus==0">自由职业</div>
                            <div v-if="detailInfo.order.workStatus==1">农牧民</div>
                            <div v-if="detailInfo.order.workStatus==2">学生</div>
                            <div v-if="detailInfo.order.workStatus==3">个体户</div>
                            <div v-if="detailInfo.order.workStatus==4">普通职员</div>
                            <div v-if="detailInfo.order.workStatus==5">企业高管/老板</div>
                            <div v-if="detailInfo.order.workStatus==6">专业技术员</div>
                            <div v-if="detailInfo.order.workStatus==7">公务员/事业单位人员 </div>
                            <div v-if="detailInfo.order.workStatus==8">退休人员</div>
                            <div v-if="detailInfo.order.workStatus==9">其他</div>
                        </el-form-item>
                    </el-col>
                    <el-col :span="24">
                        <el-form-item label="护照照片" prop="passportImg">
                            <el-image v-for="(item,index) in detailInfo.order.passportImg?detailInfo.order.passportImg.split(','):[]" :key="index"
                                style="width: 100px; height: 100px" :src="item"
                                :preview-src-list="detailInfo.order.passportImg?detailInfo.order.passportImg.split(','):[]">
                            </el-image>
                        </el-form-item>
                    </el-col>

                    <el-col :span="24">
                        <el-form-item label="审核反馈文件">
                            <!-- {{detailInfo.order.reviewRemark}} -->
                            <div v-if="detailInfo.order.reviewRemark">
                                <div v-for="(item,index) in detailInfo.order.reviewRemark?detailInfo.order.reviewRemark.split(','):[]" :key="index">
                                    <a style="color: #2440b3;text-decoration: underline;" :href="item"
                                        target="_blank">{{item.split('/')[item.split('/').length-1]}}</a>
                                </div>
                            </div>
                            <div v-else>暂无</div>
                        </el-form-item>
                    </el-col>
                </el-row>
                <div class="fromtitle">
                    <div>订单信息</div>
                </div>
                <el-row>
                    <el-col :span="12">
                        <el-form-item label="订单编号">
                            <div>{{detailInfo.order.orderCode}}</div>
                        </el-form-item>
                    </el-col>
                    <el-col :span="12">
                        <el-form-item label="订单类型" prop="orderType">
                            <div v-if="detailInfo.order.orderType==0">标准办理</div>
                            <div v-if="detailInfo.order.orderType==1">快速通道</div>
                            <div v-if="detailInfo.order.orderType==2">团队速惠</div>
                        </el-form-item>
                    </el-col>
                    <!-- <el-col :span="12">
                        <el-form-item label="签证基础表ID">
                            <div>{{detailInfo.order.baseId}}</div>
                        </el-form-item>
                    </el-col>
                    <el-col :span="12">
                        <el-form-item label="用户ID">
                            <div>{{detailInfo.order.userId}}</div>
                        </el-form-item>
                    </el-col>
                    <el-col :span="12">
                        <el-form-item label="微信用户唯一标识">
                            <div>{{detailInfo.order.openId}}</div>
                        </el-form-item>
                    </el-col> -->
                    <el-col :span="12">
                        <el-form-item label="支付时间">
                            <div>{{detailInfo.order.payTime}}</div>
                        </el-form-item>
                    </el-col>
                    <!-- <el-col :span="12">
                        <el-form-item label="支付渠道">
                            <div>{{detailInfo.order.payChannel}}</div>
                        </el-form-item>
                    </el-col> -->
                    <el-col :span="12">
                        <el-form-item label="支付金额">
                            <div>{{detailInfo.order.payMoney}}元</div>
                        </el-form-item>
                    </el-col>
                    <!-- <el-col :span="12">
                        <el-form-item label="支付回调通知">
                            <div>{{detailInfo.order.payCallbackFlag}}</div>
                        </el-form-item>
                    </el-col>
                    <el-col :span="12">
                        <el-form-item label="支付回调请求内容">
                            <div>{{detailInfo.order.payCallbackRespone}}</div>
                        </el-form-item>
                    </el-col> -->
                    <el-col :span="24">
                        <el-form-item label="交易流水号">
                            <div>{{detailInfo.order.transCode}}</div>
                        </el-form-item>
                    </el-col>
                    <el-col :span="12" v-if="form.refundTime">
                        <el-form-item label="退款时间">
                            <div>{{detailInfo.order.refundTime}}</div>
                        </el-form-item>
                    </el-col>
                    <!-- <el-col :span="12">
                        <el-form-item label="pdf文件路径">
                            <div>{{detailInfo.order.visaPdf}}</div>
                        </el-form-item>
                    </el-col>
                    <el-col :span="12">
                        <el-form-item label="文件上传时间">
                            <div>{{detailInfo.order.pdfCreateTile}}</div>
                        </el-form-item>
                    </el-col> -->
                </el-row>
            </el-form>
            <!-- <div slot="footer" class="dialog-footer">
                <el-button type="primary" @click="submitForm">确 定</el-button>
                <el-button @click="cancel">取 消</el-button>
            </div> -->
        </el-dialog>
        <!-- 上传审核信息 -->
        <el-dialog title="上传审核反馈信息" :visible.sync="openSerial" width="800px" append-to-body>
            <el-form ref="form" :model="form" :rules="rules" label-width="150px">
                <el-form-item label="审核反馈文件" prop="code">
                    <el-upload ref="upload" :file-list="fileList" :limit="fileLimitNum" :action="baseUrl+ '/system/base/upload2'"
                        :on-remove="handleRemove" :on-progress="handleProgress" :on-success="handleFileSuccess" :on-exceed="handleExceed"
                        :before-upload='beforeUpload'>
                        <el-button size="small" type="primary">点击上传</el-button>
                        <div slot="tip" class="el-upload__tip">只能上传pdf/图片文件，且不超过2M</div>
                    </el-upload>

                </el-form-item>
            </el-form>
            <div slot="footer" class="dialog-footer">
                <el-button type="primary" @click="submitFormSerial" :disabled="disabledBtn">确 定</el-button>
                <el-button @click="cancelSerial">取 消</el-button>
            </div>
        </el-dialog>
    </div>
</template>

<script>
import {
    listOrder,
    getOrder,
    delOrder,
    addOrder,
    updateOrder,
} from "@/api/order/order";

export default {
    name: "Order",
    data() {
        return {
            baseUrl: process.env.VUE_APP_BASE_API,
            // 遮罩层
            loading: true,
            // 选中数组
            ids: [],
            // 非单个禁用
            single: true,
            // 非多个禁用
            multiple: true,
            // 显示搜索条件
            showSearch: true,
            // 总条数
            total: 0,
            // 签证订单表格数据
            orderList: [],
            detailInfo: {
                order: {},
                base:{}
            },
            // 弹出层标题
            title: "",
            // 是否显示弹出层
            open: false,
            // 查询参数
            queryParams: {
                pageNum: 1,
                pageSize: 10,
                orderCode: null,
                baseId: null,
                userId: null,
                openId: null,
                orderType: null,
                orderStatus: null,
                payTime: null,
                refundTime: null,
                reviewStatus: null,
                reviewRemark: null,
                payChannel: null,
                payMoney: null,
                payCallbackFlag: null,
                payCallbackRespone: null,
                transCode: null,
                visaPdf: null,
                pdfCreateTile: null,
                peopleName: null,
                phone: null,
                address: null,
                contactsName: null,
                contactsPhone: null,
                maritalStatus: null,
                workStatus: null,
                passportImg: null,
            },
            // 表单参数
            form: {},
            // 表单校验
            rules: {
                baseId: [
                    { required: true, message: "签证基础表ID不能为空", trigger: "blur" },
                ],
            },
            orderDetail: false,
            openSerial: false,
            fileLimitNum: 3,
            serialId: '',
            serialCode:'',
            reviewStatusId: '',
            fileList: [],
            disabledBtn: false,
        };
    },
    created() {
        this.getList();
    },
    methods: {
        handleProgress(response, file, fileList) {
            console.log(response, file, fileList)
            console.log(file.status);
            if (file.status == "uploading") {
                console.log(file.status);
                this.disabledBtn = true
            }
            else{
                this.disabledBtn = false

            }
        },
        // 文件上传成功处理
        handleFileSuccess(response, file, fileList) {
            console.log(response, file, fileList)
            this.disabledBtn = false
            if (response.code == 200) {
                this.fileList = fileList
            }
            else {
                this.fileList.splice(this.fileList.length - 1, 1)
                this.$message.error(response.msg);
            }
        },
        //文件移除操作
        handleRemove(file, fileList) {
            this.fileList = fileList//或者data.fileList = []; //清空fileList所有数组    
        },
        handleExceed(files, fileList) {
            this.$message.warning(`当前限制选择 ${this.fileLimitNum} 个文件`);
        },
        beforeUpload(file) {
            console.log(file.type)
            let typeList = ['application/pdf','application/x-png','application/x-jpg','image/jpeg','image/png']
            const isLT2M = file.size / 1024 / 1024 < 2;
            if (!typeList.includes(file.type)) {
                this.$message.error('上传只能是PDF/图片格式!');
            }
            if (!isLT2M) {
                this.$message.error('上传大小不能超过 2MB!');
            }
            return typeList.includes(file.type) && isLT2M;
        },

        /** 查询签证订单列表 */
        getList() {
            this.loading = true;
            listOrder(this.queryParams).then((response) => {
                this.orderList = response.rows;
                this.total = response.total;
                this.loading = false;
            });
        },
        // 取消按钮
        cancel() {
            this.open = false;
            this.reset();
        },
        // 表单重置
        reset() {
            this.form = {
                id: null,
                orderCode: null,
                baseId: null,
                userId: null,
                openId: null,
                orderType: null,
                orderStatus: null,
                payTime: null,
                refundTime: null,
                reviewStatus: null,
                reviewRemark: null,
                payChannel: null,
                payMoney: null,
                payCallbackFlag: null,
                payCallbackRespone: null,
                transCode: null,
                visaPdf: null,
                pdfCreateTile: null,
                peopleName: null,
                phone: null,
                address: null,
                contactsName: null,
                contactsPhone: null,
                maritalStatus: null,
                workStatus: null,
                passportImg: null,
                delFlag: null,
                createBy: null,
                createTime: null,
                updateBy: null,
                updateTime: null,
                remark: null,
            };
            this.resetForm("form");
        },
        /** 搜索按钮操作 */
        handleQuery() {
            this.queryParams.pageNum = 1;
            this.getList();
        },
        /** 重置按钮操作 */
        resetQuery() {
            this.resetForm("queryForm");
            this.handleQuery();
        },
        // 多选框选中数据
        handleSelectionChange(selection) {
            this.ids = selection.map((item) => item.id);
            this.single = selection.length !== 1;
            this.multiple = !selection.length;
        },
        /** 新增按钮操作 */
        handleAdd() {
            this.reset();
            this.open = true;
            this.title = "添加签证订单";
        },
        /** 修改按钮操作 */
        handleUpdate(row) {
            this.reset();
            const id = row.id || this.ids;
            getOrder(id).then((response) => {
                this.form = response.data;
                this.open = true;
                this.title = "修改签证订单";
            });
        },
        /** 提交按钮 */
        submitForm() {
            this.$refs["form"].validate((valid) => {
                if (valid) {
                    if (this.form.id != null) {
                        updateOrder(this.form).then((response) => {
                            this.$modal.msgSuccess("修改成功");
                            this.open = false;
                            this.getList();
                        });
                    } else {
                        addOrder(this.form).then((response) => {
                            this.$modal.msgSuccess("新增成功");
                            this.open = false;
                            this.getList();
                        });
                    }
                }
            });
        },
        /** 删除按钮操作 */
        handleDelete(row) {
            const ids = row.id || this.ids;
            this.$modal
                .confirm('是否确认删除签证订单编号为"' + ids + '"的数据项？')
                .then(function () {
                    return delOrder(ids);
                })
                .then(() => {
                    this.getList();
                    this.$modal.msgSuccess("删除成功");
                })
                .catch(() => { });
        },
        /** 导出按钮操作 */
        handleExport() {
            this.download(
                "system/order/export",
                {
                    ...this.queryParams,
                },
                `order_${new Date().getTime()}.xlsx`
            );
        },
        handlePreApproval(row, value) {
            console.log('312546897');
            this.openSerial = true
            this.serialId = row.id
            this.serialCode = row.orderCode
            
            this.reviewStatusId = value
            // let that = this
            // const ids = row.id || this.ids;
            // this.$modal.confirm('确认执行此操作？').then(function () {
            //     updateInfo({ id: ids, auditStatus: value }).then(response => {
            //         that.$modal.msgSuccess("审核成功");
            //         that.getList();
            //     });
            // })
        },
        // 查看详情
        handleDetail(row) {
            const id = row.id || this.ids
            getOrder(id).then(response => {
                this.detailInfo = response.data;
                this.orderDetail = true;
                this.title = "详情";
            });
        },
        // 提交审核pdf信息
        submitFormSerial() {
            let that = this
            let serialNum = []
            if (this.fileList.length) {
                for (var i in this.fileList) {
                    serialNum.push(this.fileList[i].response.data)
                }
            }
            updateOrder({
                id: this.serialId,
                reviewRemark: serialNum.length ? serialNum.join() : '',
                reviewStatus: this.reviewStatusId,
                orderCode:this.serialCode
            }).then(response => {
                that.$modal.msgSuccess("操作成功");
                that.getList();
                this.fileList = []
                this.openSerial = false
                this.reviewStatusId = ''
            });
        },
        // 提交审核pdf信息
        cancelSerial() {
            this.fileList = []
            this.openSerial = false
            this.disabledBtn = false
        }
    },
};
</script>
